package com.tedu.bill;
/*
*数组的遍历
* */
public class TestArrayTraverse {
    public static void main(String[] args) {
        /*
        * 数组有下标
        * 通过数组的下标可以遍历数组
        * */
        //数组创建并赋值
        int[] arr = {1,2,3,4,5};
        //arr.length作为循环的条件
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
        //数组遍历赋值
        int[] a = new int[5];
        for (int i = 0; i < a.length; i++) {
            a[i] = 10;
        }
        for (int i : a) {
            System.out.println(i);
        }



    }
}
